#include <iostream>
#include <algorithm>

using namespace std;
#define int long long

int n;
int a1, a2, a3, b1, b2, b3;
const int N = 1010;
int c[N] , p[N];
string s = "The second win!";
signed main()
{
    cin >> n;
    for(int i = 1;i <= n;i ++)
    {
        cin >> c[i] >> p[i];
        if(c[i] == 0)
        {
            if(p[i] == 1) a1++;
            else if(p[i] == 2) a2++;
            else if(p[i] == 3) a3++;
        }
        else
        {
            if(p[i] == 1) b1++;
            else if(p[i] == 2) b2++;
            else if(p[i] == 3) b3++;
        }
    }
    if(a1 > b1) s = "The first win!";
    else if(a1 == b1)
    {
        if(a2 > b2) s = "The first win!";
        else if(a2 == b2)
        {
            if(a3 > b3) s = "The first win!";
        }
    }
    cout << a1 << " " << a2 << " " << a3 << endl;
    cout << b1 << " " << b2 << " " << b3 << endl;
    cout << s;
    return 0;
}